<?php
// +----------------------------------------------------------------------
// | Longbing [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright Chengdu longbing Technology Co., Ltd.
// +----------------------------------------------------------------------
// | Website http://longbing.org/
// +----------------------------------------------------------------------
// | Sales manager: +86-13558882532 / +86-13330887474
// | Technical support: +86-15680635005
// | After-sale service: +86-17361005938
// +----------------------------------------------------------------------

declare(strict_types=1);


/**
 * 更新雷达AI意向度
 *
 * @param $userId
 * @param $staff_id
 * @param $_uniacid
 * @author shuixian
 * @DataTime: 2019/12/25 23:01
 */
function longbing_radar_update_rate($userId ,$staff_id  ,$uniacid ){
    //By.jingshuixian  2019年12月23日02:40:56
    //实时更新意向度
    //第一步: 根据 员工ID 用户ID 查询绑定关系id(longbing_card_collection)

    //计算得分
    $collection = longbingGetCollection($userId ,$staff_id ,$uniacid ,$is_update = false);
    $rate = countRate($collection['id']) ;

    //更新得分
    longbingUpdateCollection($collection['id'] ,$rate);
    //更新得分
    $rateData     = longbingGetRate($userId ,$staff_id ,$uniacid);
    longbingUpdateRate($rateData['id'] ,$rate);

    return $rate;
}